<template>
  <div class="app">
    <son-component @handleChange="updateName" v-bind:username="username"></son-component>
    <button @click="submit">提交数据</button>
  </div>
</template>

<script>
import SonComponent from './SonComponent.vue'
export default {
    components: {
        SonComponent
    },
    data() {
        return {
            username: 0
        }
    },
    methods: {
        submit() {
            alert(`提交的数据 ${this.username}`)
        },
        updateName(username) {
            console.log(`更新了name属性; name = ${typeof username}`);
            this.username = Number.parseInt( username)
        }
    }
}
</script>

<style>

</style>